/**
 * Copyright (c) 2024 Huawei Technologies Co., Ltd.
 * This file is a part of the CANN Open Software.
 * Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */

/*!
 * \file async_tensor.h
 * \brief
 */

#ifndef IMPL_MATMUL_MODULES_STAGE_COPY_CUBE_IN_ASYNC_TENSOR_H
#define IMPL_MATMUL_MODULES_STAGE_COPY_CUBE_IN_ASYNC_TENSOR_H

namespace matmul {
template <class TRANS_T>
class AsyncTensor {
public:
    __aicore__ inline AsyncTensor() = default;
    __aicore__ inline AsyncTensor(const LocalTensor<TRANS_T>& tensor, bool needDeque)
    {
        tensor_ = tensor;
        needDeque_ = needDeque;
    }

    __aicore__ inline AsyncTensor<TRANS_T> operator = (const AsyncTensor<TRANS_T>& other)
    {
        if (this != &other) {
            tensor_ = other.tensor_;
            needDeque_ = other.needDeque_;
        }
        return *this;
    }
 
    __aicore__ inline AsyncTensor (const AsyncTensor<TRANS_T>& other)
    {
        if (this != &other) {
            tensor_ = other.tensor_;
            needDeque_ = other.needDeque_;
        }
    }

    __aicore__ inline ~AsyncTensor() = default;
 
    __aicore__ inline LocalTensor<TRANS_T> Get() const
    {
        return tensor_;
    }

    __aicore__ inline bool IsNeedDeQue() const
    {
        return needDeque_;
    }

private:
    LocalTensor<TRANS_T> tensor_;
    bool needDeque_;
};
} // namespace matmul

#endif //_ASYNC_TENSOR_H_